package com.atguigu.encapsolation.one;

public class TestRectangle {
    public static void main(String[] args) {
       /* Rectangle r1 = new Rectangle();
        r1.length = 6;
        r1.width = 4;
        System.out.println("r1的长和宽：" + r1.length +"，" +r1.width);

        Rectangle r2 = new Rectangle(9,5);
        System.out.println("r2的长和宽：" + r2.length +"，" +r2.width);

        Rectangle r3 = new Rectangle();
        r3.length = -8;
        r3.width = -6;
        System.out.println("r3的长和宽：" + r3.length +"，" +r3.width);

        Rectangle r4 = new Rectangle(-9,-3);
        System.out.println("r4的长和宽：" + r4.length +"，" +r4.width);*/
        //上面的代码必须对应length和width是public的情况

        Rectangle r1 = new Rectangle();
        r1.setLength(6);
        r1.setWidth(4);
        System.out.println("r1的长和宽：" + r1.getLength() +"，" +r1.getWidth());

        Rectangle r2 = new Rectangle(9,5);
        System.out.println("r2的长和宽：" + r2.getLength() +"，" +r2.getWidth());
        r2.setWidth(6);
        System.out.println("r2的长和宽：" + r2.getLength() +"，" +r2.getWidth());
    }
}
